﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Model.EntityModel;
using DataAccess;

namespace Project
{
    /// <summary>
    /// Interaction logic for PrintCitation.xaml
    /// </summary>
    public partial class PrintCitation : UserControl
    {
        public long idComplaint;
        Actor ActorDenounced = new Actor();
        Person Denounced = new Person();
        Actor ActorAggressor = new Actor();
        Person Aggressor = new Person();
        Employee functionary = new Employee();
        Model.Functionary f = new Model.Functionary();
        Citation citation = new Citation();

        public PrintCitation(long id, long idCitation)
        {
            InitializeComponent();
            UIWindowManager.SetWindowTitle(this, "Brigada De Protección a la Familia - Ver Citación");
            try
            {
                citation = CitationDataAccess.GetCitationByIdCitation(idCitation);
                idComplaint = id;
                lblCaseNumber.Content = idComplaint;
                ActorDenounced = PersonAndActorDataAccess.GetActorByTypeAndComplaintId("Denunciante", idComplaint);
                Denounced = PersonAndActorDataAccess.GetPersonById(ActorDenounced.IdPerson);
                LblDenouncedName.Content = Denounced.Name + " " + Denounced.PaternalName + " " + Denounced.MaternalName;
                ActorAggressor = PersonAndActorDataAccess.GetActorByTypeAndComplaintId("Agresor", idComplaint);
                Aggressor = PersonAndActorDataAccess.GetPersonById(ActorAggressor.IdPerson);
                LblAggressorName.Content = Aggressor.Name + " " + Aggressor.PaternalName + " " + Aggressor.MaternalName;
                f = DataBaseAccess.ReadEmployee(Convert.ToInt64(citation.IdEmployee));
                LblEmployeRank.Content = f.Rank + " " + f.Name + " " + f.PaternalName + " " + f.MaternalName;
                LblCitationDate.Content = citation.CitationDate;
                LblBoxHours.Content = citation.CitationTime.ToString();
            }
            catch
            {
                Xceed.Wpf.Toolkit.MessageBox.Show("No existe una citacion", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }

    }
}
